<?php
class C_homepage extends CI_Controller{
    public function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->library('session');
    }
    public function index(){
        //echo $xit;
        //$data['xit'] =$xit; 
        //echo $_SESSION['first_name'];
        //print_r($test);
        $test = $this->session->all_userdata();
        //print_r($test);
        //echo $test['first_name'];
        $this->load->model('M_homepage');
        $data['categories'] = $this->M_homepage->categoties();
        $data['pages'] = $this->M_homepage->pages();
        if(isset($_GET['cat'])){
            $cat_id = $_GET['cat'];
            $this->load->model('M_homepage');
            $data['content'] = $this->M_homepage->content1($cat_id);
        }
        elseif(isset($_GET['page'])){
            $page_id = $_GET['page'];
            $this->load->model('M_homepage');
            $data['content'] = $this->M_homepage->content2($page_id);
        }
        else{
            //$data['content'] = "test code igniter";
        }
        $this->load->view('v_homepage',$data);
        
    }
}
?>